<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Vue</title>
    <!-- <script src="https://unpkg.com/vue@2.6.11/dist/vue.js"></script> -->
    <style>
      #app {
        display: flex;
        flex-direction: column;
        align-items: center;
      }
    </style>
  </head>

  <body>
    <div id="app">
      <div>
        <p>{{title}}</p>
        <p>{{message}}----{{code}}</p>
      </div>
      <div data-src="src" v-text="logger"></div>
      <div v-html="source"></div>
      <div>
          v-on : <button style="width: 60px;height: 40px;cursor: pointer;" v-on:click="handleClick"></button>
    </div>

      <div>
        <p>姓名 : {{ person.name }}</p>
        <p>性别 : {{ person.sex }}</p>
        <p>年龄 : {{ person.age }}</p>
        <p>工作 : {{ person.core.work }}</p>
      </div>
      <!-- <div>
        <span>输入姓名:</span>
        <input type="text" v-model="person.name" />
      </div> -->
      <div>
        <span>输入数据:</span>
        <input type="text" v-model="logger" />
      </div>
      <div>
      </div>
    </div>
    <script src="./utils.js"></script>
    <script src="./watcher.js"></script>
    <script src="./compiler.js"></script>
    <script src="./observer.js"></script>
    <script src="./vue.js"></script>
    <script>
      // v-text解决差值表达式闪烁问题
      const app = new Vue({
        el: "#app",
        data: {
          title: "This is A Simple Vue Project",
          message: "你好吗",
          logger: "这里是 v-text",
          source: `<strong style="color:red">this is v-html</strong> vue`,
          code: "coding",
          person: {
            name: "btx",
            sex: "男",
            age: 18,
            core: {
              work: "digital farmer",
            },
          },
        },
        methods:{
            handleClick:function(e,v){
                app.$data.code='点击成功了'+ Math.random().toFixed(2)
            }
        }
    });

      console.log(app);
    </script>

  </body>
</html>